package com.it.jzs.service.admin.impl;

import com.it.jzs.dao.CommentMapper;
import com.it.jzs.dao.admin.AdminBlogMapper;
import com.it.jzs.dao.admin.AdminBlogTagsMapper;
import com.it.jzs.dao.admin.AdminTagMapper;
import com.it.jzs.dao.admin.AdminTypeMapper;
import com.it.jzs.service.admin.AdminIndexService;
import com.it.jzs.vo.Result;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;

@Service
public class AdminIndexServiceImpl implements AdminIndexService {
    @Resource
    private AdminTagMapper tagMapper;
    @Resource
    private AdminTypeMapper typeMapper;
    @Resource
    private AdminBlogMapper blogMapper;

    @Resource
    private CommentMapper commentMapper;
    @Resource
    private AdminBlogTagsMapper blogTagsMapper;

    @Override
    public Result<Object> selectIndex() {
        Integer blogCount = blogMapper.selectCount(null);
        Integer tagCount = tagMapper.selectCount(null);
        Integer typeCount = typeMapper.selectCount(null);
        Integer commentCount = commentMapper.selectCount(null);
        HashMap<String, Integer> map = new HashMap<>();
        map.put("blogCount", blogCount);
        map.put("tagCount", tagCount);
        map.put("typeCount", typeCount);
        map.put("commentCount", commentCount);
        return Result.success(map,"成功");
    }
}
